package com.example.springbootdemo.com.example.springbootdemo.controller;

import com.example.springbootdemo.com.example.springbootdemo.com.example.springbootdemo.domain.User;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
public class UserController {

	@RequestMapping("hello1")
	public String showHello() {

		return "hello 你好";
	}


	@RequestMapping("pojo")
	public User showUser() {
		User u=new User();
			u.setId(1);
			u.setUsername("张三丰");
			u.setAddress("武当山");
		return u;
	}

	@RequestMapping("maps")
	public Map<String,Object> showMap(){
			Map<String,Object> maps=new HashMap<String, Object>();
			maps.put("userName","zhang");
			maps.put("age","19");

			return maps;
	}

	@RequestMapping("list")
	public List<User> showList(){
	List<User>	list=new ArrayList<User>();
		User u=new User();
		u.setId(1);
		u.setUsername("张三丰");
		u.setAddress("武当山");
		User u1=new User();
		u1.setId(2);
		u1.setUsername("张丰");
		u1.setAddress("武山");

		list.add(u);
		list.add(u1);

		return list;
	}





}
